package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.cnswhy.cloud.server.common.entity.enumeration.ExpressCompany;
import com.cnswhy.cloud.server.common.entity.enumeration.WithdrawType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2020-10-17
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_buy_back_order")
@ApiModel(value = "BuyBackOrder", description = "")
@AllArgsConstructor
public class BuyBackOrder extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "")
    @TableField("customer_id")
    @Excel(name = "")
    private Long customerId;

    @ApiModelProperty(value = "")
    @Length(max = 11, message = "长度不能超过11")
    @TableField(value = "login_name", condition = LIKE)
    @Excel(name = "客户手机号")
    private String loginName;

    @ApiModelProperty(value = "")
    @NotEmpty(message = "不能为空")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "order_num", condition = LIKE)
    @Excel(name = "回购订单")
    private String orderNum;

    @ApiModelProperty(value = "")
    @NotNull(message = "不能为空")
    @TableField("spell_order_id")
    @Excel(name = "拼团单号")
    private Long spellOrderId;

    @ApiModelProperty(value = "")
    @NotNull(message = "不能为空")
    @TableField("product_id")
    @Excel(name = "")
    private Long productId;

    @ApiModelProperty(value = "")
    @Length(max = 255, message = "长度不能超过255")
    @TableField(value = "product_name", condition = LIKE)
    @Excel(name = "产品名字")
    private String productName;

    @ApiModelProperty(value = "")
    @Length(max = 255, message = "长度不能超过255")
    @TableField(value = "product_img", condition = LIKE)
    @Excel(name = "")
    private String productImg;

    @ApiModelProperty(value = "")
    @TableField("order_price")
    @Excel(name = "单价")
    private BigDecimal orderPrice;

    @ApiModelProperty(value = "")
    @TableField("cost_price")
    @Excel(name = "成本")
    private BigDecimal costPrice;

    @ApiModelProperty(value = "")
    @TableField("original_price")
    @Excel(name = "原价")
    private BigDecimal originalPrice;

    /**
     * 1待支付2待发货3待收货4待评价5完成
     */
    @ApiModelProperty(value = "1待支付2待发货3待收货4待评价5完成")
    @TableField("status")
    @Excel(name = "回购状态", replace = {"待支付_1", "代发货_2", "待收货_3", "待评价_4", "完成_5",  "_null"})
    private Integer status;

    /**
     * 1支付宝2微信
     */
    @ApiModelProperty(value = "1支付宝2微信")
    @TableField("pay_type")
    @Excel(name = "支付方式", replace = {"支付宝_1", "微信_2",  "_null"})
    private Integer payType;

    @ApiModelProperty(value = "")
    @TableField("address_id")
    @Excel(name = "")
    private Long addressId;

    /**
     * 回购类型1客户购买2系统回购
     */
    @ApiModelProperty(value = "回购类型1客户购买2系统回购")
    @TableField("back_type")
    @Excel(name = "回购类型", replace = {"客户购买_1", "系统回购_2",  "_null"})
    private Integer backType;

    /**
     * 支付宝微信返回交易流水号
     */
    @ApiModelProperty(value = "支付宝微信返回交易流水号")
    @Length(max = 100, message = "支付宝微信返回交易流水号长度不能超过100")
    @TableField(value = "return_order_num", condition = LIKE)
    @Excel(name = "支付宝微信返回交易流水号")
    private String returnOrderNum;

    @ApiModelProperty(value = "")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "express_no", condition = LIKE)
    @Excel(name = "快递单号")
    private String expressNo;
    @ApiModelProperty(value = "回购日期")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "sett_date", condition = LIKE)
    @Excel(name = "回购日期")
    private String settDate;

    /*@ApiModelProperty(value = "")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "express_company", condition = LIKE)
    @Excel(name = "")
    private String expressCompany;*/
    /**
     * 权限类型 #WithdrawType{BANKCARD:银行卡;ALIPAY:支付宝账号;}
     */
    @ApiModelProperty(value = "")
    @TableField("express_company")
    @Excel(name = "")
    private ExpressCompany expressCompany;
    @TableField("stock_id")
    private Long stockId;
    @TableField("spec_values")
    @Excel(name = "规格")
    private String specValues;
    @TableField(exist = false)
    private CustomerReceiver customerReceiver;

    @Builder
    public BuyBackOrder(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser, Long updateUser, 
                    Long customerId, String loginName, String orderNum, Long spellOrderId, Long productId, 
                    String productName, String productImg, BigDecimal orderPrice, BigDecimal costPrice, BigDecimal originalPrice, Integer status, 
                    Integer payType, Long addressId, Integer backType, String returnOrderNum, String expressNo, ExpressCompany expressCompany, String settDate,Long stockId,String specValues) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.customerId = customerId;
        this.loginName = loginName;
        this.orderNum = orderNum;
        this.spellOrderId = spellOrderId;
        this.productId = productId;
        this.productName = productName;
        this.productImg = productImg;
        this.orderPrice = orderPrice;
        this.costPrice = costPrice;
        this.originalPrice = originalPrice;
        this.status = status;
        this.payType = payType;
        this.addressId = addressId;
        this.backType = backType;
        this.returnOrderNum = returnOrderNum;
        this.expressNo = expressNo;
        this.expressCompany = expressCompany;
        this.settDate = settDate;
        this.stockId = stockId;
        this.specValues = specValues;
    }

}
